package com.fingard.dsp.bank.directbank.bocom01;

import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;

import com.fingard.constant.Format;
import com.fingard.dsp.bank.directbank.bankInterface.IElecBillQuery;
import com.fingard.dsp.bank.reqrespobj.elecbillquery.*;
import com.fingard.dsp.bank.reqrespobj.elecbillquery.detail.*;
import com.fingard.io.FileHelper;
import com.fingard.text.MFSHelper;
import com.fingard.text.StringHelper;
import com.fingard.util.DateHelper;
import com.fingard.xml.XmlTextReader;
import com.fingard.xml.XmlTextWriter;

/**
 * Created by F on 2018/10/17.
 */
public class BOCOM01ElecBill extends BOCOM01Base implements IElecBillQuery {
    /**
     * 可操作票据查询--待银行开发
     */
    @Override
    public RetAtsB001OperBillQry D_OperBill_Query_Req(ReqB001OperBillQry query) throws Exception {
        RetAtsB001OperBillQry retAts = new RetAtsB001OperBillQry(query.reqHeader);
        retAts.respCode = "0";
        retAts.writeStart();
        query.readRecord();
        try {
            //查询提示收票待签收和背书待签收的票据
            if ("2".equals(query.detail.queryType) && ("3".equals(query.detail.busiType) || "4".equals(query.detail.busiType))) {
                querySignBill(query, retAts);
            } else {
                queryHoldBill(query, retAts);
            }

        } catch (Exception ex) {
            ex.printStackTrace();
            retAts = new RetAtsB001OperBillQry(query.reqHeader);
            retAts.respCode = "-1";
            retAts.respInfo = ex.getMessage();
            retAts.writeStart();
        }
        retAts.writeRespCode(retAts.respCode);
        retAts.writeRespInfo(retAts.respInfo);
        retAts.writeEnd();
        return retAts;
    }

    /**
     * 查询当天收票待签收和背书待签收票据
     *
     * @param query
     * @param retAts
     */
    private void querySignBill(ReqB001OperBillQry query, RetAtsB001OperBillQry retAts) throws Exception {
        tr_code = "420106";//交易码
        req_no = getQryTransID();//序号

        int totalPage = -1;
        int curPage = 0;
        do {
            XmlTextWriter xmlWriter = new XmlTextWriter();
            writeCommonHeader(xmlWriter);
            //拼接请求报文体
            xmlWriter.writeStartElement("body");
//        <ap>/<body>/<PagIdx> 页码C6 Y如果不足 6 位，左补 0
            xmlWriter.writeElementString("PagIdx", String.format("%06d", ++curPage));
//        <ap>/<body>/<QryDt>  通讯交易标识  C19 Y
            xmlWriter.writeElementString("QryDt", Format.DateTime2Format.format(new Date()));
//        <ap>/<body>/<QryAcct>  查询账号 C40 Y 签约电子票据
            xmlWriter.writeElementString("QryAcct", query.detail.actNum);
            xmlWriter.writeEndDocument();
            //请求银行
            String[] tmpStrRet = sendToBank(xmlWriter.toXmlString());
//            String[] tmpStrRet = new String[]{"", "<ap><head><tr_code>420106</tr_code><corp_no>9000008304</corp_no><req_no>175003000257</req_no><serial_no>  </serial_no><ans_no>  </ans_no><next_no>  </next_no><tr_acdt>20200430</tr_acdt><tr_time>175009</tr_time><ans_code>0</ans_code><ans_info>  </ans_info><particular_code>0000</particular_code><particular_info>  </particular_info><atom_tr_count>1</atom_tr_count><reserved></reserved></head><body><serial_record>出票日期|到期日|出票人账号|出票人名称|最后一个背书人账号|最后一个背书人名称|金额|票号|出票备注|背书备注|收票状态|背书状态|20200409|20201010|3602179719100232885|广东扬帆药业有限公司|218803281059|广东金泰药业有限公司|185000.00|110258100572720200409613757372||广东金泰||S|20200428|20201028|10650301040001104|无锡市锡山人民医院|510903799510802|无锡东方药业有限公司|39998.94|110330206503420200428627149573||||S|20200429|20201029|257215095478|郑州大学第二附属医院|371902000910502|郑州恒源医药有限公司|55137.80|110449106401420200429629742212||||S|20200429|20201029|32001614847052500519|江南大学附属医院|510903799510802|无锡东方药业有限公司|324967.00|110530200055020200429629848051||||S|20200401|20201001|39120188000048159|深圳市英可瑞科技股份有限公司|201000038754822|温州市新光医药有限公司|67757.92|130358403912620200401610468439||||S|20200330|20200929|78150188000177819|国药控股国大山西医药有限公司|68060154700003117|华润山西康兴源医药有限公司|244530.00|130358407815020200330608459507||||S|20191128|20200528|157526950|长春市茂顺药业有限公司|35910188000239861|吉林省北药医药股份有限公司|27500.00|130524100001720191128526619817||||S|20200421|20201021|0234014180000347|龙工（上海）挖掘机制造有限公司|250719586237|洛阳世鸿药业有限公司|250000.00|130529000234220200421620720533||||S|20200422|20201022|134041511010002662|浙江文信机电制造有限公司|77040154740006367|天津天易医药有限公司|50000.00|130634500337920200422621893659||||S|20200424|20201024|102082512010008004|深圳市中天元实业有限公司|699512716|广东鑫宏源药业有限公司|200000.00|13065840001482020042462411718 1||||S|20200429|20201029|351903107110705|山西国大万民药房连锁有限公司|0505009209024546114|山西天士力康美徕医药有限公司长治分公司|200000.00|130816103902620200429628775384||||W|20200429|20201029|351903107110705|山西国大万民药房连锁有限公司|0505009209024546114|山西天士力康美徕医药有限公司长治分公司|200000.00|130816103902620200429628775753||||W|20200429|20201023|485340100100011943|山西国邦药业有限公司|68060154700003117|华润山西康兴源医药有限公司|202000.00|130916100534920200429629241751||||S|20200426|20201026|502050100100109720|江西九州通药业有限公司|7391010182200182427|河南九州通医药有限公司|20000.00|130942100205820200426625378663||||W|20200429|20201028|16410154900000329|禹州市中心医院|941005010042318895|河南德济堂医药有限公司|65000.00|131050300001120200429629324426||货款||S|20200427|20201027|72130154700002047|西安怡康医药连锁有限责任公司|3700022409200014161|陕西玉龙医药有限公司|1281342.21|131079100012520200427627110289||||S|20200415|20201015|3311110120100010708|衢州市永方机械制造有限公司|806051101421002436|陕西泰昂医药有限公司|80943.07|131334100011420200415617779357||||S|20200421|20201021|3301190120100018319|台州市驰隆车辆部件有限公司|43001510271059999888|湖南和顺医药有限责任公司|100000.00|131334501016820200421621097014||||S|20200415|20201015|419901010160026002|河南省人民医院|371902000910502|郑州恒源医药有限公司|939699.40|131349109901520200415617374516||||S|20200427|20201027|7180302010100011|洛阳天浩泰轨道装备制造有限公司|7050302010900021|洛阳万国药业有限公司|100000.00|131349300045320200427625836006||||S|20200429|20201029|53620188000056558|国药控股山西临汾有限公司|||126494.00|130317700001820200429628703742|||S||20200429|20201029|35910188000239861|吉林省北药医药股份有限公司|||156394.00|130324100011820200429628759955|||S||20200429|20201029|161482746|东辽县医药药材有限责任公司|||43800.00|130524100004120200429628790163|||S||20200429|20201023|485340100100011943|山西国邦药业有限公司|||90190.00|130916100534920200429629241647|||S||20200429|20201029|562010100100996307|上药科园信海黑龙江医药有限公司|||71300.00|130926100002820200429628704492|||S||20200428|20201027|73010154700012267|四川旭天药业有限公司|||236985.00|131065100001320200429629313733|||S||20200430|20201030|21210154700002127|渭南九州通正元医药有限公司|||338510.40|131079700001120200430630944284|||S||20200430|20201030|99501880126777939|河南省越人医药有限公司|||51675.00|131349100002120200430630688066|||S||20200428|20201028|6510000110120100202726|四川仁通医药有限公司|||1694012.20|131665100003920200428627322246|||S||</serial_record><field_num>12</field_num><record_num>29</record_num><totalPage>3</totalPage><PagIdx>000001</PagIdx></body></ap>"};
            if (tmpStrRet[0].length() == 0) {
                StringBuilder tmpSbMsg = new StringBuilder();
                XmlTextReader tmpBkReader = loadBankRespXmlReader(tmpStrRet[1], tmpSbMsg);
                if (tmpBkReader != null) {
                    String returnCode = tmpBkReader.getFirstText("/ap/head/particular_code");
                    String returnMsg = tmpBkReader.getFirstText("/ap/head/particular_info");
                    if ("0000".equals(returnCode)) {
                        int fieldNum = Integer.valueOf(tmpBkReader.getFirstText("/ap/body/field_num"));
                        int recordNum = Integer.valueOf(tmpBkReader.getFirstText("/ap/body/record_num"));
                        if (totalPage == -1) {
                            totalPage = Integer.valueOf(tmpBkReader.getFirstText("/ap/body/totalPage"));
                        }
                        String tmpDataMFS = tmpBkReader.getFirstText("/ap/body/serial_record");
                        ArrayList<String[]> tmpArrayList = MFSHelper.getTextArray(tmpDataMFS, "|", fieldNum, recordNum + 1, tmpSbMsg);
                        for (int i = 1; i <= recordNum; i++) {
//                           0出票日期(C8)|1到 期日(C8)|2出票人 帐号(C40)|3出票人 名称(C60)|
//                            4最后背书人帐号(C40)|5最后背书人名称(C60)|6票据金额(C20)|7电子票据号 码(C30)|
//                            8出票备注(C60)|9背书备注(C60)|10收票状态(C2)|11背书状态(C2)|
                            String[] recordInfo = tmpArrayList.get(i);
                            RetAtsB001OperBillQryDetail detail = new RetAtsB001OperBillQryDetail();
                            if ("3".equals(query.detail.busiType) && "W".equals(recordInfo[10])) {
                                detail.billStatus = "030001";
                                detail.applyAct = recordInfo[2];
                                detail.applyName = recordInfo[3];
                            } else if ("4".equals(query.detail.busiType) && "W".equals(recordInfo[11])) {
                                detail.billStatus = "100001";
                                detail.applyAct = recordInfo[4];
                                detail.applyName = recordInfo[5];
                                detail.memo = recordInfo[9];
                            } else {
                                continue;
                            }
                            detail.billNo = recordInfo[7];
                            detail.billType = detail.billNo.startsWith("1") ? "EM001" : "EM002";
                            detail.billAmt = recordInfo[6];
                            detail.issDate = DateHelper.convertD8toD10(recordInfo[0]);
                            detail.dueDate = DateHelper.convertD8toD10(recordInfo[1]);
                            detail.drawAct = recordInfo[2];
                            detail.drawName = recordInfo[3];
                            retAts.writeDetail(detail);
                        }
                    } else if ("0500".equals(returnCode) || "E014".equals(returnCode) || "9003".equals(returnCode)) {
                        retAts.respCode = "0";
                        retAts.respInfo = returnMsg;
                    } else {
                        throw new Exception(returnMsg);
                    }
                } else {
                    throw new Exception(tmpSbMsg.toString());
                }
            } else {
                throw new Exception(tmpStrRet[1]);
            }
        } while (curPage < totalPage);
    }


    /**
     * 通过票据持有接口获取申请类票据
     *
     * @param query
     * @param retAts
     * @throws Exception
     */
    private void queryHoldBill(ReqB001OperBillQry query, RetAtsB001OperBillQry retAts) throws Exception {
        //交行通过票据状态来判断可以进行哪些操作
        List<String> billStatusList = getStatusByBusi(query.detail.queryType, query.detail.busiType, query.detail.overdueFlag, query.detail.recourseType);
        if (billStatusList == null && billStatusList.size() == 0) {
            throw new Exception("银行不支持该交易类型");
        }
        //获取票据到期日时间
        Calendar calendar = Calendar.getInstance();
        String queryDate = getBankConfig().getValueAsString("queryDate");
        if (StringHelper.hasAnyChar(queryDate)) {
            calendar.setTime(Format.Date8Format.parse(queryDate));
        }
        String start = getBankConfig().getValueAsString("DateBeforeNow");
        int monthStart = StringHelper.hasAnyChar(start) ? Integer.valueOf(start) : 0;
        String queryLength = getBankConfig().getValueAsString("QueryLength");
        int dateLength = StringHelper.hasAnyChar(queryLength) ? Integer.valueOf(queryLength) : 12;
        //获取查询时间的起点
        calendar.set(Calendar.DAY_OF_MONTH, 1);
        calendar.add(Calendar.MONTH, monthStart);
        String calendarStart = Format.Date8Format.format(calendar.getTime());
        //获取查询时间的终点
        calendar.add(Calendar.MONTH, dateLength - 1);
        calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMaximum(Calendar.DAY_OF_MONTH));
        String calendarEnd = Format.Date8Format.format(calendar.getTime());


        tr_code = "420101";//交易码
        req_no = getQryTransID();//序号
        XmlTextWriter xmlWriter = new XmlTextWriter();
        writeCommonHeader(xmlWriter);
//        int totalPage = 0;
//        int nowReadPage = 0;
        //拼接请求报文体
        xmlWriter.writeStartElement("body");
//            <ap>/<body>/<QryAcct> 查询账号 C40 Y 签约电子票据
        xmlWriter.writeElementString("QryAcct", query.detail.actNum);
//                    <ap>/<body>/<Tp>      票据类型 C4 Y
        xmlWriter.writeElementString("Tp", "1".equals(query.detail.billType) ? "AC01" : "AC02");
//            <ap>/<body>/<Role>    票据种类 C1 Y
        if ("2".equals(query.detail.queryType)) {
            xmlWriter.writeElementString("Role", "0");
        } else {
            xmlWriter.writeElementString("Role", "3");
        }
//            <ap>/<body>/<Ccy>     币种  C3
        xmlWriter.writeElementString("Ccy", "CNY");
//                    <ap>/<body>/<IsseAmtMin> 票 据 金
        xmlWriter.writeElementString("IsseAmtMin", "");
//            <ap>/<body>/<IsseAmtMax> 票 据 金
        xmlWriter.writeElementString("IsseAmtMax", "");
//            <ap>/<body>/<IsseDtMin>  出 票 日
        xmlWriter.writeElementString("IsseDtMin", "");
//            <ap>/<body>/<IsseDtMax>
        xmlWriter.writeElementString("IsseDtMax", "");
//            <ap>/<body>/<DueDtMin>
        xmlWriter.writeElementString("DueDtMin", calendarStart);
//            <ap>/<body>/<DueDtMax>
        xmlWriter.writeElementString("DueDtMax", calendarEnd);
//            <ap>/<body>/<DrwrPayeeAcctId>
        xmlWriter.writeElementString("DrwrPayeeAcctId", "");
        xmlWriter.writeEndDocument();
        //请求银行
        String[] tmpStrRet = sendToBank(xmlWriter.toXmlString());
        if (tmpStrRet[0].length() == 0) {
            StringBuilder tmpSbMsg = new StringBuilder();
            XmlTextReader tmpBkReader = loadBankRespXmlReader(tmpStrRet[1], tmpSbMsg);
            if (tmpBkReader != null) {
                String returnCode = tmpBkReader.getFirstText("/ap/head/particular_code");
                String returnMsg = tmpBkReader.getFirstText("/ap/head/particular_info");
                if ("0000".equals(returnCode)) {
                    int fieldNum = Integer.valueOf(tmpBkReader.getFirstText("/ap/body/field_num"));
                    int recordNum = Integer.valueOf(tmpBkReader.getFirstText("/ap/body/record_num"));
                    String tmpDataMFS = tmpBkReader.getFirstText("/ap/body/serial_record");
                    ArrayList<String[]> tmpArrayList = MFSHelper.getTextArray(tmpDataMFS, "|", fieldNum, recordNum + 1, tmpSbMsg);
                    for (int i = 1; i <= recordNum; i++) {
//                            0电子票据号码|1票据类型|2票据金额|3币种属性|4出票日期|5到期日|6交易合同号|7发票号码|
//                            8票据状态|9出票人账号|10出票人名称|11收票人账号|12收票人名称|13承兑人账号|14承兑人名称|
//                            15持票人账号|16持票人名称|17出票人开户行名|18收票人开户行名|19承对人开户行名|20出票人行号|
//                            21收票人行号|22承兑人行号|23持票人开户行行号|
                        String[] recordInfo = tmpArrayList.get(i);
                        if (!billStatusList.contains(recordInfo[8])) {
                            continue;
                        }
                        RetAtsB001OperBillQryDetail detail = new RetAtsB001OperBillQryDetail();
                        detail.billNo = recordInfo[0];
                        if ("AC01".equals(recordInfo[1])) {
                            detail.billType = "EM001";
                        } else if ("AC02".equals(recordInfo[1])) {
                            detail.billType = "EM002";
                        }
                        detail.billAmt = recordInfo[2];
                        detail.issDate = DateHelper.convertD8toD10(recordInfo[4]);
                        detail.dueDate = DateHelper.convertD8toD10(recordInfo[5]);
                        detail.contractNo = recordInfo[6];
                        detail.invoiceNo = recordInfo[7];
                        detail.billStatus = recordInfo[8];
                        detail.drawAct = recordInfo[9];
                        detail.drawName = recordInfo[10];
                        detail.drawBnkCode = recordInfo[20];
                        detail.drawBnkName = recordInfo[17];
                        detail.accpAct = recordInfo[13];
                        detail.accpName = recordInfo[14];
                        detail.accpBnkCode = recordInfo[22];
                        detail.accpBnkName = recordInfo[19];
                        detail.payeeAct = recordInfo[11];
                        detail.payeeName = recordInfo[12];
                        detail.payeeBnkCode = recordInfo[21];
                        detail.payeeBnkName = recordInfo[18];
                        retAts.writeDetail(detail);
                    }
                } else if ("0500".equals(returnCode) || "E014".equals(returnCode) || "9003".equals(returnCode)) {
                    retAts.respCode = "0";
                    retAts.respInfo = returnMsg;
                } else {
                    throw new Exception(returnMsg);
                }
            } else {
                throw new Exception(tmpSbMsg.toString());
            }
        } else {
            throw new Exception(tmpStrRet[1]);
        }
    }


    //获取满足业务条件的票据状态
    private List<String> getStatusByBusi(String queryType, String busiType, String overdueFlag, String recourseType) {
        List<String> billStatusList = new ArrayList<String>();
        int busiInt = Integer.valueOf(busiType);
        if ("1".equals(queryType)) {
            switch (busiInt) {
                case 2:
//                    出票已登记(010004)
                    billStatusList.add("010004");
                    break;
                case 3:
//                    承兑已签收(020006)
                    billStatusList.add("020006");
                    break;
                case 4:
                case 5:
                case 10:
//                    提示收票已签收(030006)
//                    背书已签收(100006)
//                    质押解除已签收(190006)
//                    回购式贴现赎回已签收(120006)
                    billStatusList.add("030006");
                    billStatusList.add("100006");
                    billStatusList.add("190006");
                    billStatusList.add("120006");
                    break;
                case 12:
                    if ("1".equals(overdueFlag)) {
//                    提示收票已签收(030006)
//                    背书已签收(100006)
//                    买断式贴现已签收(110103)
//                    回购式贴现赎回已签收(120003)
//                    回购式贴现已逾赎回截止日(110218)
//                    买断式转贴现已签收(130103)
//                    回购式转贴现赎回已签收(140006)
//                    回购式转贴现已逾赎回截止日(130218)
//                    买断式再贴现已签收(150106)
//                    回购式再贴现赎回已签收(160006)
//                    回购式再贴现已逾赎回截止日(150218)
//                    质押解除已签收(190006)
//                    质押已至票据到期日(180020)
//                    提示付款已拒付（不可拒付追索）(200512)
//                    提示付款已拒付（可拒付追索，可追所有人）(200412)
//                    央行卖票已签收(250006)
                        billStatusList.add("030006");
                        billStatusList.add("100006");
                        billStatusList.add("110103");
                        billStatusList.add("120003");
                        billStatusList.add("110218");
                        billStatusList.add("130103");
                        billStatusList.add("140006");
                        billStatusList.add("130218");
                        billStatusList.add("150106");
                        billStatusList.add("160006");
                        billStatusList.add("150218");
                        billStatusList.add("190006");
                        billStatusList.add("180020");
                        billStatusList.add("200512");
                        billStatusList.add("200412");
                        billStatusList.add("250006");
                    } else {
//                    提示收票已签收(030006)
//                    背书已签收(100006)
//                    买断式贴现已签收(110103)
//                    回购式贴现赎回已签收(120003)
//                    回购式贴现已逾赎回截止日(110218)
//                    买断式转贴现已签收(130103)
//                    回购式转贴现赎回已签收(140006)
//                    回购式转贴现已逾赎回截止日(130218)
//                    买断式再贴现已签收(150106)
//                    回购式再贴现赎回已签收(160006)
//                    回购式再贴现已逾赎回截止日(150218)
//                    质押解除已签收(190006)
//                    质押已至票据到期日(180020)
//                    提示付款已拒付（不可拒付追索）(200512)
//                    提示付款已拒付（可拒付追索，可追所有人）(200412)
//                    央行卖票已签收(250006)
//                    提示付款已拒付（可拒付追索，只可追出票人，承兑人及其保证人）(200312)
//                    逾期提示付款已拒付（可拒付追索，可追所有人）(210412)
//                    逾期提示付款已拒付（可拒付追索，只可追出票人，承兑人及其保证人）(210312)
                        billStatusList.add("030006");
                        billStatusList.add("100006");
                        billStatusList.add("110103");
                        billStatusList.add("120003");
                        billStatusList.add("110218");
                        billStatusList.add("130103");
                        billStatusList.add("140006");
                        billStatusList.add("130218");
                        billStatusList.add("150106");
                        billStatusList.add("160006");
                        billStatusList.add("150218");
                        billStatusList.add("190006");
                        billStatusList.add("180020");
                        billStatusList.add("200512");
                        billStatusList.add("200412");
                        billStatusList.add("250006");
                        billStatusList.add("200312");
                        billStatusList.add("210412");
                        billStatusList.add("210312");
                    }
                    break;
                case 13:
                    if ("1".equals(recourseType)) {
//                        提示付款已拒付（可拒付追索，可追所有人）(200412)
//                        提示付款已拒付（可拒付追索，只可追出票人，承兑人及其保证人）(200312)
//                        逾期提示付款已拒付（可拒付追索，可追所有人）(210412)
//                        逾期提示付款已拒付（可拒付追索，只可追出票人，承兑人及其保证人）(210312)
//                        拒付追索待清偿(220607)
//                        拒付追索同意清偿待签收(230606)
                        billStatusList.add("200412");
                        billStatusList.add("200312");
                        billStatusList.add("210412");
                        billStatusList.add("210312");
                        billStatusList.add("220607");
                        billStatusList.add("230606");
                    } else {
//                        提示收票已签收(030006)
//                        背书已签收(100006)
//                        买断式贴现已签收(110103)
//                        回购式贴现赎回已签收(120003)
//                        回购式贴现已逾赎回截止日(110218)
//                        买断式转贴现已签收(130103)
//                        回购式转贴现赎回已签收(140006)
//                        回购式转贴现已逾赎回截止日(130218)
//                        买断式再贴现已签收(150106)
//                        回购式再贴现赎回已签收(160006)
//                        回购式再贴现已逾赎回截止日(150218)
//                        质押解除已签收(190006)
//                        质押已至票据到期日(180020)
//                        央行卖票已签收(250006)
//                        提示付款已拒付（不可拒付追索）(200512)
//                        非拒付追索待清偿（220707）
//                        非拒付追索已撤销（220710）
//                        非拒付追索同意清偿待签（230701）
                        billStatusList.add("030006");
                        billStatusList.add("100006");
                        billStatusList.add("110103");
                        billStatusList.add("120003");
                        billStatusList.add("110218");
                        billStatusList.add("130103");
                        billStatusList.add("140006");
                        billStatusList.add("130218");
                        billStatusList.add("150106");
                        billStatusList.add("160006");
                        billStatusList.add("150218");
                        billStatusList.add("190006");
                        billStatusList.add("180020");
                        billStatusList.add("250006");
                        billStatusList.add("200512");
                        billStatusList.add("220707");
                        billStatusList.add("220710");
                        billStatusList.add("230701");
                    }
                    break;
            }
        } else if ("2".equals(queryType)) {
            switch (busiInt) {
                case 3:
//                    030001 提示收票待签收
                    billStatusList.add("030001");
                    break;
                case 4:
//                    100001 背书待签收
                    billStatusList.add("100001");
                    break;
                case 6:
//                    190001 质押解除待签收
                    billStatusList.add("190001");
                    break;
                case 11:
//                    120001 回购式贴现赎回签收
                    billStatusList.add("120001");
                    break;
                case 14:
//                    230601 拒付追索同意清偿待签收
//                    230701 非拒付追索同意清偿待签收
                    billStatusList.add("230601");
                    billStatusList.add("230701");
                    break;
            }
        } else if ("3".equals(queryType)) {
            switch (busiInt) {
                case 1:
//                    出票已登记(010004)
                    billStatusList.add("120001");
//                    承兑已签收(020006)
                    billStatusList.add("020006");
                    break;
                case 2:
//                提示承兑待签收(020001)
                    billStatusList.add("020001");
                    break;
                case 3:
//                提示收票待签收(030001)
                    billStatusList.add("030001");
                    break;
                case 4:
//                    背书待签收(100001)
                    billStatusList.add("100001");
                    break;
                case 5:
//                    质押待签收(180001)
                    billStatusList.add("180001");
                    break;
                case 10:
//                    买断式贴现待签收(110101)
//                    回购式贴现待签收(110201)
                    billStatusList.add("110101");
                    billStatusList.add("110201");
                    break;
                case 12:
//                    提示付款待签收(200001)
//                    逾期提示付款待签收(210001)
                    if ("1".equals(overdueFlag)) {
                        billStatusList.add("200001");
                    } else {
                        billStatusList.add("210001");
                    }
                    break;
                case 13:
//                    拒付追索待清偿(220607)
//                    非拒付追索待清偿(220707)
                    if ("1".equals(recourseType)) {
                        billStatusList.add("220607");
                    } else {
                        billStatusList.add("220707");
                    }
                    break;
            }
        }
        return billStatusList;
    }

    /**
     * 票据操作明细查询
     */
    @Override
    public RetAtsB002BillTransQry D_B002_BillTrans_Query(ReqB002BillTransQry query) throws Exception {
        return null;
    }

    /**
     * 正面信息查询
     */
    @Override
    public RetAtsB004BillFrontQry D_B004_BillFront_Query(ReqB004BillFrontQry query) throws Exception {
        RetAtsB004BillFrontQry retAts = new RetAtsB004BillFrontQry(query.reqHeader);
        retAts.writeStart();
        query.readRecord();
        try {
            tr_code = "421102";//交易码
            req_no = getQryTransID();//序号
            XmlTextWriter xmlWriter = new XmlTextWriter();
            writeCommonHeader(xmlWriter);
            //拼接请求报文体
            xmlWriter.writeStartElement("body");
            xmlWriter.writeElementString("QryAcct", query.detail.actNum);//账号
            xmlWriter.writeElementString("IdNb", query.detail.billNo);//电子票据号码
            xmlWriter.writeEndElement();
            xmlWriter.writeEndDocument();
            //请求银行
            String[] tmpStrRet = sendToBank(xmlWriter.toXmlString());
            if (tmpStrRet[0].length() == 0) {
                StringBuilder tmpSbMsg = new StringBuilder();
                XmlTextReader tmpBkReader = loadBankRespXmlReader(tmpStrRet[1], tmpSbMsg);
                if (tmpBkReader != null) {
                    String code = tmpBkReader.getFirstText("/ap/head/ans_code");
                    String info = tmpBkReader.getFirstText("/ap/head/ans_info");
                    if ("0".equals(code)) {
                        String tmpRetCode = tmpBkReader.getFirstText("/ap/head/particular_code");
                        String tmpRspMsg = tmpBkReader.getFirstText("/ap/head/particular_info");
                        if (isActiveRetCode(tmpRetCode)) {
                            retAts.respCode = "0";
                            retAts.respInfo = tmpRspMsg;
                            retAts.billNo = tmpBkReader.getFirstText("/ap/body/IdNb");//电子票据
                            retAts.billType = "AC01".equals(tmpBkReader.getFirstText("/ap/body/Tp")) ? "1" : "2";
                            retAts.issDate = DateHelper.convertD8toD10(tmpBkReader.getFirstText("/ap/body/IsseDt"));//出票日
                            retAts.dueDate = DateHelper.convertD8toD10(tmpBkReader.getFirstText("/ap/body/DueDt"));//到期日
                            retAts.billAmt = tmpBkReader.getFirstText("/ap/body/IsseAmt");//票据金额
                            retAts.transFlag = "EM00".equals(tmpBkReader.getFirstText("/ap/body/BanEndrsmtMk")) ? "1" : "0";//背书转让
                            //出票人
                            retAts.drawName = tmpBkReader.getFirstText("/ap/body/DrwrNm");
                            retAts.drawAct = tmpBkReader.getFirstText("/ap/body/DrwrAcctId");
                            retAts.drawBnkName = tmpBkReader.getFirstText("/ap/body/DrwrAcctSvcrNm");
                            retAts.drawBnkCode = tmpBkReader.getFirstText("/ap/body/DrwrAcctSvcr");
                            retAts.creditLv = tmpBkReader.getFirstText("/ap/body/DrwrCdtRatgs");
                            retAts.gradeAgent = tmpBkReader.getFirstText("/ap/body/CdtRatgAgcy");
                            retAts.gradeDueDate = tmpBkReader.getFirstText("/ap/body/CdtRatDueDt");
                            //承兑人
                            retAts.accpName = tmpBkReader.getFirstText("/ap/body/AccptrNm");
                            retAts.accpAct = tmpBkReader.getFirstText("/ap/body/AccptrAcctId");
                            retAts.accpBnkCode = tmpBkReader.getFirstText("/ap/body/AccptrAcctSvcr");
                            retAts.accpBnkName = tmpBkReader.getFirstText("/ap/body/AccptrAcctSvcrNm");
                            retAts.accpCredit = tmpBkReader.getFirstText("/ap/body/ACPTCRGS");
                            retAts.accpGrade = tmpBkReader.getFirstText("/ap/body/ACPTCRAC");
                            retAts.accpGradeDue = tmpBkReader.getFirstText("/ap/body/ACPTCRDD");
                            //收款人
                            retAts.payeeName = tmpBkReader.getFirstText("/ap/body/PyeeAcctNm");
                            retAts.payeeAct = tmpBkReader.getFirstText("/ap/body/PyeeAcctId");
                            retAts.payeeBnkCode = tmpBkReader.getFirstText("/ap/body/PyeeAcctSvcr");
                            retAts.payeeBnkName = tmpBkReader.getFirstText("/ap/body/PyeeAcctSvcrNm");
                            //票据状态
                            retAts.billState = tmpBkReader.getFirstText("/ap/body/Sts");
                        } else {
                            retAts.respCode = "-1";
                            retAts.respInfo = tmpRspMsg;
                        }
                    } else {
                        retAts.respCode = "-1";
                        retAts.respInfo = info;
                    }
                } else {
                    retAts.respCode = "-1";
                    retAts.respInfo = tmpSbMsg.toString();
                }
            } else {
                retAts.respCode = "-1";
                retAts.respInfo = tmpStrRet[1];
            }
        } catch (Exception ex) {
            ex.printStackTrace();
            retAts.respCode = "-1";
            retAts.respInfo = ex.getMessage();
        }
        retAts.writeRetDetail();
        retAts.writeEnd();
        return retAts;
    }

    /**
     * 票据背面信息查询
     */
    @Override
    public RetAtsB005BillBackQry D_B005_BillBack_Query(ReqB005BillBackQry query) throws Exception {
        RetAtsB005BillBackQry retAts = new RetAtsB005BillBackQry(query.reqHeader);
        retAts.writeStart();
        query.readRecord();
        String respCode = "";
        String respInfo = "";
        try {
            tr_code = "421102";//交易码
            req_no = getQryTransID();//序号
            XmlTextWriter xmlWriter = new XmlTextWriter();
            writeCommonHeader(xmlWriter);
            //拼接请求报文体
            xmlWriter.writeStartElement("body");
            xmlWriter.writeElementString("QryAcct", query.detail.actNum);//账号
            xmlWriter.writeElementString("IdNb", query.detail.billNo);//电子票据号码
            xmlWriter.writeEndElement();
            xmlWriter.writeEndDocument();
            //请求银行
            String[] tmpStrRet = sendToBank(xmlWriter.toXmlString());
            if (tmpStrRet[0].length() == 0) {
                StringBuilder tmpSbMsg = new StringBuilder();
                XmlTextReader tmpBkReader = loadBankRespXmlReader(tmpStrRet[1], tmpSbMsg);
                if (tmpBkReader != null) {
                    String code = tmpBkReader.getFirstText("/ap/head/ans_code");
                    String info = tmpBkReader.getFirstText("/ap/head/ans_info");
                    if ("0".equals(code)) {
                        String tmpRetCode = tmpBkReader.getFirstText("/ap/head/particular_code");
                        String tmpRspMsg = tmpBkReader.getFirstText("/ap/head/particular_info");
                        if (isActiveRetCode(tmpRetCode)) {
                            retAts.writeRespCode("0");
                            retAts.writeRespInfo(tmpRspMsg);
                            //背书信息
                            while (tmpBkReader.read("/ap/body/tran1/rcd1")) {
                                RetAtsB005BillBackQryDetail detail = new RetAtsB005BillBackQryDetail();
                                detail.respCode = "0";
                                detail.billNo = query.detail.billNo;
                                String respType = tmpBkReader.readedXElement.getSingleTextNotNull("STS10");
                                if (!"S".equals(respType)) {
                                    continue;
                                }
                                detail.billNo = query.billNo;
                                //操作代码取值
                                /// 交易类型代码 2  承兑 3  收票 4  撤票 10  背书转让 11  贴现 12  回购式贴现赎回 13  转贴现 14  回购式转贴现赎回 15  再贴现 16  回购式再贴现赎回 25  央行卖出商业汇票 17  保证 18  质押 19  质押解除 20  提示付款 21  逾期提示付款 22  追索 23  追索同意清偿
                                detail.transCode = "10";
                                //申请人
                                detail.applyName = tmpBkReader.readedXElement.getSingleTextNotNull("ERNM");
                                //接收人
                                detail.receName = tmpBkReader.readedXElement.getSingleTextNotNull("EENM");
                                //申请日期
                                detail.applyDate = DateHelper.convertD8toD10(tmpBkReader.readedXElement.getSingleTextNotNull("DT"));
                                //应答标记 1--签收 2--驳回
                                detail.respFlag = "1";
                                //背书转让标识 1-可再转让 0-不得转让
                                detail.transFlag = "EM00".equals(tmpBkReader.readedXElement.getSingleTextNotNull("BANENDRSMTMK")) ? "1" : "0";
                                retAts.writeDetail(detail);
                            }
                            //质押信息
                            while (tmpBkReader.read("/ap/body/tran2/rcd2")) {
                                RetAtsB005BillBackQryDetail detail = new RetAtsB005BillBackQryDetail();
                                detail.respCode = "0";
                                detail.billNo = query.detail.billNo;
                                String respType = tmpBkReader.readedXElement.getSingleTextNotNull("STS12");
                                if (!"S".equals(respType)) {
                                    continue;
                                }
                                //电子票据号码
                                detail.billNo = query.billNo;
                                //操作代码取值
                                /// 交易类型代码 2  承兑 3  收票 4  撤票 10  背书转让 11  贴现 12  回购式贴现赎回 13  转贴现 14  回购式转贴现赎回 15  再贴现 16  回购式再贴现赎回 25  央行卖出商业汇票 17  保证 18  质押 19  质押解除 20  提示付款 21  逾期提示付款 22  追索 23  追索同意清偿
                                detail.transCode = "18";
                                //申请人
                                detail.applyName = tmpBkReader.readedXElement.getSingleTextNotNull("CPRNM");
                                //接收人
                                detail.receName = tmpBkReader.readedXElement.getSingleTextNotNull("CBKNM");
                                //申请日期
                                detail.applyDate = DateHelper.convertD8toD10(tmpBkReader.readedXElement.getSingleTextNotNull("DT11"));
                                //应答标记 1--签收 2--驳回
                                detail.respFlag = "1";
                                retAts.writeDetail(detail);
                            }
                            //追索信息
                            while (tmpBkReader.read("/ap/body/tran3/rcd3")) {
                                RetAtsB005BillBackQryDetail detail = new RetAtsB005BillBackQryDetail();
                                detail.respCode = "0";
                                detail.billNo = query.detail.billNo;
                                String respType = tmpBkReader.readedXElement.getSingleTextNotNull("STS17");
                                if (!"S".equals(respType)) {
                                    continue;
                                }
                                //电子票据号码
                                detail.billNo = query.billNo;
                                //操作代码取值
                                /// 交易类型代码 2  承兑 3  收票 4  撤票 10  背书转让 11  贴现 12  回购式贴现赎回 13  转贴现 14  回购式转贴现赎回 15  再贴现 16  回购式再贴现赎回 25  央行卖出商业汇票 17  保证 18  质押 19  质押解除 20  提示付款 21  逾期提示付款 22  追索 23  追索同意清偿
                                detail.transCode = "22";
                                //申请人
                                detail.applyName = tmpBkReader.readedXElement.getSingleTextNotNull("RCRNM");
                                //接收人
                                detail.receName = tmpBkReader.readedXElement.getSingleTextNotNull("RGRNM");
                                //申请日期
                                detail.applyDate = DateHelper.convertD8toD10(tmpBkReader.readedXElement.getSingleTextNotNull("APPLDT"));
                                //应答标记 1--签收 2--驳回
                                detail.respFlag = "1";
                                //追索类型 1-拒付追索 2-非拒付追索
                                detail.recourseType = tmpBkReader.readedXElement.getSingleTextNotNull("TP16");
                                retAts.writeDetail(detail);
                            }
                            //贴现信息
                            while (tmpBkReader.read("/ap/body/tran4/rcd4")) {
                                RetAtsB005BillBackQryDetail detail = new RetAtsB005BillBackQryDetail();
                                detail.respCode = "0";
                                detail.billNo = query.detail.billNo;
                                String respType = tmpBkReader.readedXElement.getSingleTextNotNull("STS24");
                                if (!"S".equals(respType)) {
                                    continue;
                                }
                                //电子票据号码
                                detail.billNo = query.billNo;
                                //操作代码取值
                                /// 交易类型代码 2  承兑 3  收票 4  撤票 10  背书转让 11  贴现 12  回购式贴现赎回 13  转贴现 14  回购式转贴现赎回 15  再贴现 16  回购式再贴现赎回 25  央行卖出商业汇票 17  保证 18  质押 19  质押解除 20  提示付款 21  逾期提示付款 22  追索 23  追索同意清偿
                                detail.transCode = "11";
                                //申请人
                                detail.applyName = tmpBkReader.readedXElement.getSingleTextNotNull("DSCNTPROPSRNM");
                                //接收人
                                detail.receName = tmpBkReader.readedXElement.getSingleTextNotNull("DSCNTBKNM");
                                //申请日期
                                detail.applyDate = DateHelper.convertD8toD10(tmpBkReader.readedXElement.getSingleTextNotNull("DSAPPDT"));
                                //操作日期
                                detail.respDate = "";
                                //背书转让标识 1-可再转让 0-不得转让
                                detail.transFlag = tmpBkReader.readedXElement.getSingleTextNotNull("BANENDRSMTMK21");
                                //回购开放日
                                detail.repOpenDate = DateHelper.convertD8toD10(tmpBkReader.readedXElement.getSingleTextNotNull("RPDOPENDT"));
                                //回购截止日期
                                detail.repDueDate = DateHelper.convertD8toD10(tmpBkReader.readedXElement.getSingleTextNotNull("RPDDUEDT"));
                                //应答标记 1--签收 2--驳回
                                detail.respFlag = "1";
                                retAts.writeDetail(detail);
                            }
                            //提示付款信息
                            while (tmpBkReader.read("/ap/body/tran6/rcd6")) {
                                RetAtsB005BillBackQryDetail detail = new RetAtsB005BillBackQryDetail();
                                detail.respCode = "0";
                                detail.billNo = query.detail.billNo;
                                String respType = tmpBkReader.readedXElement.getSingleTextNotNull("STS32");
                                if (!"S".equals(respType)) {
                                    continue;
                                }
                                //电子票据号码 <STS32>
                                detail.billNo = query.billNo;
                                //操作代码取值
                                /// 交易类型代码 2  承兑 3  收票 4  撤票 10  背书转让 11  贴现 12  回购式贴现赎回 13  转贴现 14  回购式转贴现赎回 15  再贴现 16  回购式再贴现赎回 25  央行卖出商业汇票 17  保证 18  质押 19  质押解除 20  提示付款 21  逾期提示付款 22  追索 23  追索同意清偿
                                detail.transCode = "20";
                                //申请人
                                detail.applyName = tmpBkReader.readedXElement.getSingleTextNotNull("DHRNM");
                                //接收人
                                detail.receName = tmpBkReader.readedXElement.getSingleTextNotNull("");
                                //申请日期
                                detail.applyDate = DateHelper.convertD8toD10(tmpBkReader.readedXElement.getSingleTextNotNull("APPLDT31"));
                                //应答标记 1--签收 2--驳回
                                detail.respFlag = "1";
                                //拒付理由代码 1--DC00 2--DC01 N--DC0(N-1) 99--DC09
                                String unPayCode = tmpBkReader.readedXElement.getSingleTextNotNull("DSHNRCD");
                                if (StringHelper.hasAnyChar(unPayCode)) {
                                    int unPayCodeInt = Integer.valueOf(unPayCode.charAt(3));
                                    if (unPayCodeInt == 9) {
                                        detail.unPayCode = "99";
                                    } else {
                                        detail.unPayCode = 1 + unPayCodeInt + "";
                                    }
                                }
                                retAts.writeDetail(detail);
                            }
                        } else {
                            respCode = "-1";
                            respInfo = tmpRspMsg;
                        }
                    } else {
                        respCode = "-1";
                        respInfo = info;
                    }
                } else {
                    respCode = "-1";
                    respInfo = tmpSbMsg.toString();
                }
            } else {
                respCode = "-1";
                respInfo = tmpStrRet[1];
            }
        } catch (Exception ex) {
            ex.printStackTrace();
            respCode = "-1";
            respInfo = ex.getMessage();
        }
        if ("-1".equals(respCode)) {
            retAts = new RetAtsB005BillBackQry(query.reqHeader);
            retAts.writeStart();
            retAts.writeRespCode(respCode);
            retAts.writeRespCode(respInfo);
        }
        retAts.writeEnd();
        return retAts;
    }

    /**
     * 票据交易状态查询
     */
    @Override
    public RetAtsB006BillStateQry D_B006_BillState_Qeury(ReqB006BillStateQry query) throws Exception {
        RetAtsB006BillStateQry retAts = new RetAtsB006BillStateQry(query.reqHeader);
        RetAtsB006BillStateQryDetail detail = new RetAtsB006BillStateQryDetail();
        retAts.writeStart();
        query.readRecord();
        try {
            tr_code = "420105";//交易码
            req_no = getQryTransID();//序号
            XmlTextWriter xmlWriter = new XmlTextWriter();
            writeCommonHeader(xmlWriter);
            //拼接请求报文体
            xmlWriter.writeStartElement("body");
            xmlWriter.writeElementString("qry_no", codeToAscii(query.detail.reqSeqID));//发起方序号
            xmlWriter.writeEndElement();
            xmlWriter.writeEndDocument();
            //请求银行
            String[] tmpStrRet = sendToBank(xmlWriter.toXmlString());
            if (tmpStrRet[0].length() == 0) {
                StringBuilder getBankRetInfo = new StringBuilder();
                //解析银行返回
                XmlTextReader tmpBkReader = loadBankRespXmlReader(tmpStrRet[1], getBankRetInfo);
                if (tmpBkReader != null) {
                    String code = tmpBkReader.getFirstText("/ap/head/ans_code");
                    String info = tmpBkReader.getFirstText("/ap/head/ans_info");
                    if ("0".equals(code)) {
                        String retCode = tmpBkReader.getFirstText("/ap/head/particular_code");
                        String retMsg = tmpBkReader.getFirstText("/ap/head/particular_info");
                        if (isActiveRetCode(retCode)) {
//                            String atsStatus = "PE1I0000,PE1S9999,PE1S4001,PE1I0001,PE1I0002";
                            String transState = tmpBkReader.getFirstText("/ap/body/prccd");
                            detail.respCode = "0";//响应码
                            detail.respInfo = tmpBkReader.getFirstText("/ap/body/prcmsg");//响应信息
                            detail.reqSeqID = query.detail.reqSeqID;//交易流水号
                            detail.billNo = tmpBkReader.getFirstText("/ap/body/IdNb");//电子票据号码
//                            if (atsStatus.contains(transState.trim())) {
                            detail.transState = transState;//处理状态码
//                            } else {
//                                detail.transState = "others";//处理状态码
//                            }
                            detail.payInfoCode = detail.transState;//交易信息码
                        } else {
                            detail.respCode = "-1";
                            detail.respInfo = retMsg.toString();
                        }
                    } else {
                        detail.respCode = "-1";
                        detail.respInfo = info;
                    }
                } else {
                    detail.respCode = "-1";
                    detail.respInfo = tmpBkReader.toString();
                }
            } else {
                detail.respCode = "-1";
                detail.respInfo = tmpStrRet[0].toString();
            }
        } catch (Exception ex) {
            ex.printStackTrace();
            detail.respCode = "-1";
            detail.respInfo = ex.getMessage();
        }
        retAts.writeDetail(detail);
        retAts.writeEnd();
        return retAts;
    }

    /**
     * 可追索人查询 ？？？ 应该写错了。待验证
     */
    @Override
    public RetAtsB007BillKzsrQry D_B007_BillKzsr_Query(ReqB007BillKzsrQry query) throws Exception {
        RetAtsB007BillKzsrQry retAts = new RetAtsB007BillKzsrQry(query.reqHeader);
        RetAtsB007BillKzsrQryDetail detail = new RetAtsB007BillKzsrQryDetail();
        retAts.writeStart();
        tr_code = "420102";//交易码
        req_no = getQryTransID();//序号
        XmlTextWriter xmlWriter = new XmlTextWriter();
        writeCommonHeader(xmlWriter);
        query.readRecord();
        //拼接请求报文体
        xmlWriter.writeStartElement("body");
        xmlWriter.writeElementString("QryAcct", query.detail.actNum);//账号
        xmlWriter.writeElementString("IdNb", query.detail.billNo);//电子票据号码
        xmlWriter.writeEndElement();
        xmlWriter.writeEndDocument();
        //请求银行
        String[] tmpStrRet = sendToBank(xmlWriter.toXmlString());
        if (tmpStrRet[0].length() == 0) {
            StringBuilder getBankRetInfo = new StringBuilder();
            //解析银行返回
            XmlTextReader tmpBkReader = loadBankRespXmlReader(tmpStrRet[1], getBankRetInfo);
            if (tmpBkReader != null) {
                String code = tmpBkReader.getFirstText("/ap/head/ans_code");
                String info = tmpBkReader.getFirstText("/ap/head/ans_info");
                if ("0".equals(code)) {
                    String retCode = tmpBkReader.getFirstText("/ap/head/particular_code");
                    String retMsg = tmpBkReader.getFirstText("/ap/head/particular_info");
                    if (isActiveRetCode(retCode)) {
                        retAts.respCode = "0";
                        retAts.respInfo = retMsg;
                        retAts.billNo = tmpBkReader.getFirstText("/ap/body/IdNb");
                        retAts.writeRespInfos();
                        //追索信息
                        String record = tmpBkReader.getFirstText("/ap/body/serial_record_Rcrss");
                        String[] array = record.split("\\|");
                        detail.receName = array[7].trim();
                        detail.receCode = "";
                        detail.receAct = array[8].trim();
                        detail.receBnkName = array[9].trim();
                        detail.receBnkCode = "";
                        retAts.writeDetail(detail);
                    } else {
                        retAts.respCode = "-1";
                        retAts.respInfo = retMsg.toString();
                        retAts.writeRespInfos();
                    }
                } else {
                    retAts.respCode = "-1";
                    retAts.respInfo = info;
                }
            } else {
                retAts.respCode = "-1";
                retAts.respInfo = tmpBkReader.toString();
                retAts.writeRespInfos();
            }
        } else {
            retAts.respCode = "-1";
            retAts.respInfo = tmpStrRet[0].toString();
            retAts.writeRespInfos();
        }
        retAts.writeEnd();
        return retAts;
    }

    /**
     * 历史票据查询
     */
    @Override
    public RetAtsB008HistoricalBillQry D_B008_HistoricalBillQuery(ReqB008HistoricalBillQry query) throws Exception {
        return null;
    }

    @Override
    public RetAtsB009DrawBillQry D_B009_DrawBillQuery(ReqB009DrawBillQry query) throws Exception {
        return null;
    }

    @Override
    public RetAtsB010ProtocolStateQry D_B010_ProtocolStateQuery(ReqB010ProtocolStateQry query) throws Exception {
        return null;
    }

    @Override
    public RetAtsB011TransFlagQry D_B011_TransFlagQuery(ReqB011TransFlagQry query) throws Exception {
        return null;
    }
}
